﻿using System;
using System.Collections.Generic;
using System.Text;
using Torch.WL.Business.Interface;
using Torch.FrameWork.Utility;
using Torch.WL.Business.CleanChina;
using Torch.WL.Entity.CleanChina;

namespace Torch.WL.Business
{
    public class RewardListProvider : BaseProvider<RewardListProvider.RequestDataInfo>, IDataProvider
    {
        public RewardListProvider(string _jsonInfo)
            : base(_jsonInfo)
        {

        }

        public IMessageInfo Do()
        {
            message.data = ProcessResponseData();
            return message;
        }

        private List<ResponseDataInfo> ProcessResponseData()
        {
            //use postdata.data to process responseData
            List<ResponseDataInfo> list = new List<ResponseDataInfo>();


            List<TbRewardEntity> listReward = TbRewardManager.Instance().GetRewardListByCache();

            listReward.ForEach(delegate(TbRewardEntity entity)
            {
                    list.Add(new ResponseDataInfo() {  reward_id  = entity.rewardId, reward_name=entity.rewardName });
                });

            #region 虚代码
            /*
            ResponseDataInfo responseData = new ResponseDataInfo();
            responseData.companyid = 100;
            responseData.companyname = "上海清洁用品制造有限公司";
            responseData.logo = ConfigHelper.GetConfigString("WebsiteImageUrl") + "loading_1.jpg";
            list.Add(responseData);

            responseData = new ResponseDataInfo();
            responseData.companyid = 101;
            responseData.companyname = "北京清洁用品制造有限公司";
            responseData.logo = ConfigHelper.GetConfigString("WebsiteImageUrl") + "loading_1.jpg";
            list.Add(responseData);

            responseData = new ResponseDataInfo();

            responseData.companyid = 102;
            responseData.companyname = "广州清洁用品制造有限公司";
            responseData.logo = ConfigHelper.GetConfigString("WebsiteImageUrl") + "loading_1.jpg";
            list.Add(responseData);
            */
            #endregion

            return list;

         
        }

        public class RequestDataInfo
        {           
        }

        public class ResponseDataInfo
        {
            public int reward_id { get; set; }
            public string reward_name { get; set; }

        }


    }
}
